<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<body>
<div class="container">

    <div th:fragment="header">
        <nav class="navbar navbar-inverse">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand" th:href="@{/}">myCalendar</a>
                </div>
                <div id="navbar" class="collapse navbar-collapse">
                    <ul class="nav navbar-nav">
                        <li class="active"><a id="navWelcomeLink" th:href="@{/}">Welcome</a></li>

                        <li sec:authorize-url="/events/"><a id="navEventsLink" th:href="@{/events/}">All Events</a></li>

                        <li sec:authorize="isAuthenticated()"><a id="navMyEventsLink" th:href="@{/events/my}">My Events</a></li>

                        <li th:if="${showCreateLink}"><a id="navCreateEventLink" th:href="@{/events/form}">Create Event</a></li>

                        <li th:if="${showAdminLink}"><a id="navH2Link" target="_blank" th:href="@{/admin/h2}">H2</a></li>
                    </ul>

                    <ul class="nav navbar-nav pull-right" sec:authorize="isAuthenticated()">
                        <li>
                            <p class="navbar-text">Welcome <div class="navbar-text" th:text="${#authentication.name}">User</div></p>
                        </li>
                        <li>
                            <a id="navLogoutLink" class="btn btn-default" role="button"  th:href="@{/logout}">Logout</a>
                        </li>
                        <li>&nbsp;|&nbsp;</li>
                    </ul>
                    <ul class="nav navbar-nav pull-right" sec:authorize=" !isAuthenticated()">
                        <li><a id="navSignupLink" class="btn btn-default" role="button" th:href="@{/signup/form}">Signup</a></li>
                        <li><a id="navLoginLink" class="btn btn-default" role="button" th:href="@{/login/form}">Login</a></li>
                        <li>&nbsp;|&nbsp;</li>
                    </ul>
                </div>
            </div>
        </nav>
    </div>
</div>

</body>
</html>
